﻿@model IEnumerable<User>
@Html.Extra()
<table>
    <thead>
        <tr>
            <th>
                用户名
            </th>
            <th>
                姓名
            </th>
            <th>
                角色
            </th>
            <th>
                是否锁定
            </th>
            <th>
                是否启用
            </th>
            @if (string.IsNullOrEmpty(Request["Application"]))
            {
                <th>
                    应用
                </th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr id="@item.Id">
                <td>
                    @Html.Hidden("UserName", item.UserName)
                    @item.UserName
                </td>
                <td>
                    @item.Name
                </td>
                <td>
                    @{
            var roles = CommonAppService.Current.GetUserRoles(item.Id).Select(r => r.Name);
                    }
                    @ConvertHelper.ArrayToString(roles)
                </td>
                <td>
                    @Html.Show().CheckBox(item.IsLockout)
                </td>
                <td>
                    @Html.Show().CheckBox(item.IsEnable)
                </td>
                @if (string.IsNullOrEmpty(Request["Application"]))
                {
                    <td>
                        @CommonAppService.Current.GetApplicationName(item.Application)
                    </td>
                }
            </tr>
        }
    </tbody>
</table>
